package com.kaifamiao.month04.day07.work;

import java.util.Scanner;

public class Test01 {

    // 统计元音 a o e i u  出现的次数
    public static int count(String str) {
        int count = 0;
        for (int i = 0; i < str.length(); i ++) {
            if (str.charAt(i) == 'a' || str.charAt(i) == 'o' ||
                    str.charAt(i) == 'e' || str.charAt(i) == 'i' || str.charAt(i) == 'u') {
                count++;
            }
        }
        return count;
    }

    public static int count2(String str) {
        String newStr = str.replaceAll("[aoeiu]","");
        return str.length() - newStr.length();
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String str = in.next();
        System.out.println("您输入的字符串： " + str + " 里面的元音字母个数是：" + count2(str));
    }
}
